import { Inject, Optional, Injectable } from "@angular/core";
import { Observer, Observable, throwError as _observableThrow, of as _observableOf } from "rxjs";
import { CommonHttpClient } from "services/common-httpclient";
import { map, mergeMap as _observableMergeMap, catchError as _observableCatch } from "rxjs/operators";
import { PagedResultDto } from "@shared/component-base";
import { HttpClient, HttpHeaders, HttpResponse, HttpResponseBase } from "@angular/common/http";


@Injectable()
export class AuditlogMessageService {
    private _commonhttp: CommonHttpClient;

    constructor(@Inject(CommonHttpClient) commonhttp: CommonHttpClient) {
        this._commonhttp = commonhttp;
    }

    getById(id: string): Observable<any> {
        let _url = "/api/services/app/DataDictionary/GetByIdAsync";
        let param = { 'id': id };
        return this._commonhttp.get(_url, param).pipe(map(data => {
            return data;
        }));
    }
    /**
    * 获取数据
    * @param param
    */
    getAll(params: any): Observable<PagedResultDto> {
        let url_ = "/api/services/app/AuditLog/GetAuditLogs";
        return this._commonhttp.get(url_, params).pipe(map(data => {
            const result = new PagedResultDto();
            result.items = data.items;
            result.totalCount = data.totalCount;
            console.log(result.items)
            return result;
        }));
    }

    //导出指定项目估算 id 是项目ID
    exportFileAsync(params: any): Observable<any> {

        let url_ = "/api/services/app/AuditLog/ExcelPathAsync";
        return this._commonhttp.post(url_, params).pipe(map(data => {
            return data;
        }))
    }


}


